Skip to content

Conversation

@Ian-Nara
Copy link
Contributor

No description provided.

@Ian-Nara Ian-Nara changed the base branch from main to ian-UID2-6337-asynchronous-full-queue-process December 2, 2025 06:12
@Ian-Nara Ian-Nara marked this pull request as ready for review December 2, 2025 06:47
@Ian-Nara Ian-Nara changed the title update traffic calculator to hardcoded baseline traffic calculator with hardcoded baseline Dec 2, 2025
/**
* Calculate total duration of allowlist ranges that overlap with the given time window.
*/
long getAllowlistDuration(long t, long windowStart) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should either validate that the allow list has no overlaps, or regenerate it as a new deduplicated allow list.

LOGGER.info("Traffic calculation: oldestQueueTs={}", oldestQueueTs);

// Define start time of the delta evaluation window [newestDeltaTs - 24h, newestDeltaTs]
long deltaWindowStart = newestDeltaTs - this.evaluationWindowSeconds - getAllowlistDuration(newestDeltaTs, newestDeltaTs - this.evaluationWindowSeconds);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If evaluationWindowSeconds is 5 hours, the original range is [3, 8], and the allow list to exclude is {[2, 3], [6, 7]}, then the start time should be 1, not 2.


// Count SQS messages in [oldestQueueTs, oldestQueueTs + 5m]
if (sqsMessages != null && !sqsMessages.isEmpty()) {
int sqsCount = countSqsMessages(sqsMessages, oldestQueueTs);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

After the change, we’ll remove the fixed 5-minute window and instead process SQS messages until either 5 minutes have passed or 10k messages have been read, whichever comes first.

Ian-Nara and others added 6 commits December 4, 2025 13:14
…-UID2-6146-update-traffic-calculator-to-hardcoded-baseline
…seline' into ian-UID2-6151-add-traffic-filter-class
* Temporarily Suppress libpng CVE-2025-64720 and CVE-2025-65018

* Upgrade uid2-shared

}

LOGGER.info("SQS messages: {} in window [oldestQueueTs={}, oldestQueueTs+5m={}]", count, oldestQueueTs, windowEnd);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This needs to be updated to process all SQS messages in a single loop instead of only those from a 5-minute window. Just in case we get 1 billion requests, we stop after processing 10k messages rather than strictly using a 5-minute window.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Got it. So if processing 10k messages takes about 3 minutes, we’ll still scan the full 5-minute window, but after 3 minutes there simply won’t be any more messages to read, is it correct?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yep

@caroline-ttd caroline-ttd self-requested a review December 5, 2025 01:26
@Ian-Nara Ian-Nara merged commit 4388f1b into ian-UID2-6337-asynchronous-full-queue-process Dec 6, 2025
4 checks passed
@Ian-Nara Ian-Nara deleted the ian-UID2-6146-update-traffic-calculator-to-hardcoded-baseline branch December 6, 2025 00:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants